﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Giaiphongmatbang.DataModel;

namespace Giaiphongmatbang.BLL
{
    public class SupportOtherRepository
    {
        QLGPMBEntities db = new QLGPMBEntities();

        public SupportOther GetByID(int ID)
        {
            return db.SupportOthers.FirstOrDefault(p => p.SupportOtherID == ID);
        }

        public IEnumerable<SupportOther> GetByProjectIDAndCMND(int ProjectID, string CMND)
        {
            return db.SupportOthers.Where(p => p.Support.ProjectID == ProjectID && p.Support.CMND==CMND);
        }

        public void Delete(int ID)
        {
            SupportOther instance = GetByID(ID);
            db.DeleteObject(instance);
            db.SaveChanges();
        }
    }
}